AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')

local OutputValues = {
	[Game.BUILD] = "OnBuildPhase",
	[Game.FIGHT] = "OnCombatPhase"
}

function ENT:Initialize()
	self:DrawShadow( false )
	
end

function ENT:KeyValue( key, value )
	if EntityDebug then
		print( "Key value: ",  self, key, value )
	end
	
	if string.sub(key, 1, 2):lower() == "on" then
		self:StoreOutput( key, value )
	end

end

function ENT:AcceptInput( name, activator, caller, data )
	if EntityDebug then
		print( "AcceptInput: ",  self, name, activator, caller, data )
	end
end


hook.Add("StateChange", "FirePhaseControl", function( state )

	for _, v in pairs( ents.FindByClass("game_phase_control") ) do
		
		v:TriggerOutput( OutputValues[ state ] , NULL)
		v:TriggerOutput( "OnSwitchPhase" , NULL)
	
	end

	if EntityDebug then
		print("Game  state changed!")
	end
	
end )